Skip to content

Port 14.4 - 14.20 changes to REL_2_STABLE, p1 #1574

Open
reshke wants to merge 12 commits intoapache:REL_2_STABLEfrom
reshke:rel_2_1566p1
Open

Port 14.4 - 14.20 changes to REL_2_STABLE, p1 #1574
reshke wants to merge 12 commits intoapache:REL_2_STABLEfrom
reshke:rel_2_1566p1

Conversation

@reshke
Copy link
Contributor

@reshke reshke commented Feb 11, 2026

same as #1567

@reshke reshke changed the title Rel 2 1566p1 Port 14.4 - 14.20 changes to REL_2_STABLE, p1 Feb 11, 2026
@tuhaihe
Copy link
Member

tuhaihe commented Feb 11, 2026

Hi @reshke , I suggest not rushing to cherry-pick the commits to the REL_2_STABLE branch. We can do that in a batch with the next release.

@reshke
Copy link
Contributor Author

reshke commented Feb 12, 2026

Hi @reshke , I suggest not rushing to cherry-pick the commits to the REL_2_STABLE branch. We can do that in a batch with the next release.

Okay. So, what will be the batch size? Is it all 14.4 - 14.20 commits, all commits that did make it to main, or 14.4 - 14.5 portion (maybe some other rule?).

I will update this PR incrementally, then. And before next release, we will rebase & commit

@tuhaihe
Copy link
Member

tuhaihe commented Feb 12, 2026

I will update this PR incrementally, then. And before next release, we will rebase & commit

It sounds make sense. Thanks.

@leborchuk
Copy link
Contributor

Sorry, I don't see here commit eacd9c7

It is relevant REL_2_STABLE, could we merge it to REL_2_STABLE too?

@reshke reshke force-pushed the rel_2_1566p1 branch 2 times, most recently from 34a0430 to 06cc38c Compare March 6, 2026 19:31
@reshke
Copy link
Contributor Author

reshke commented Mar 6, 2026

Included changes from #1578 #1577 and #1568

@tuhaihe
Copy link
Member

tuhaihe commented Mar 8, 2026

I have a thought about the cherry-pick strategy for REL_2_STABLE.

Instead of picking individual commits, would it make sense to start from the commits after the previous cherry-pick PR (#1547) and move forward from there?

My concern is that selecting commits piecemeal might make it harder to manage in the next release cycle, since more commits will be added in between and it may become less clear which ones were already backported.

If this approach makes sense, we could also keep this PR and use it as the cherry-pick PR for the next release.

@reshke
Copy link
Contributor Author

reshke commented Mar 10, 2026

I have a thought about the cherry-pick strategy for REL_2_STABLE.

Instead of picking individual commits, would it make sense to start from the commits after the previous cherry-pick PR (#1547) and move forward from there?

My concern is that selecting commits piecemeal might make it harder to manage in the next release cycle, since more commits will be added in between and it may become less clear which ones were already backported.

If this approach makes sense, we could also keep this PR and use it as the cherry-pick PR for the next release.

Hi! I did not get your idea... As of today, the last agreement we met in Apache Cloudberry dev list was [0], which is:

PG 14.4 → 14.20 → REL_2_STABLE directly
CVE-only fixes → main (already mostly done)
Keep main clean for PG16 upgrade

So, after this PR there will be no contribution to main branch which is 14.4-14.20 range, so nothing to back-patch. Kernel upgrade will continue in REL_2_STABLE only, tracked here[1].

If I am mistaken is something please clarify ....

[0] https://lists.apache.org/thread/bkrx7470kk08kvz2t7rv68gll1sp67vm

[1] https://docs.google.com/spreadsheets/d/1vjjEb39QPyXO-nDJZ0tHAtReIQKka0S2YnD2r1AFhkk

@tuhaihe
Copy link
Member

tuhaihe commented Mar 11, 2026

Hi @reshke, let me clarify my previous comment.

My concern is about the cherry-pick strategy for the upcoming release (e.g., 2.2). Currently, the main branch contains not only the commits cherry-picked from PostgreSQL (14.4-14.20), but also other development changes mixed in between.

For easier management, I suggest we start from the point where the last 2.1 cherry-pick ended and cherry-pick all eligible commits from main to REL_2_STABLE together. This would be more convenient than:

  1. The current PR only includes commits cherry-picked from PostgreSQL
  2. Other eligible commits on main would need to be identified and cherry-picked separately

My suggested approach would ensure we don't miss any commits that should be included in the next release, and it's easier to track what has been backported.

Just want to make sure, does this sound good to you?

@reshke
Copy link
Contributor Author

reshke commented Mar 11, 2026

Hi @reshke, let me clarify my previous comment.

My concern is about the cherry-pick strategy for the upcoming release (e.g., 2.2). Currently, the main branch contains not only the commits cherry-picked from PostgreSQL (14.4-14.20), but also other development changes mixed in between.

For easier management, I suggest we start from the point where the last 2.1 cherry-pick ended and cherry-pick all eligible commits from main to REL_2_STABLE together. This would be more convenient than:

  1. The current PR only includes commits cherry-picked from PostgreSQL
  2. Other eligible commits on main would need to be identified and cherry-picked separately

My suggested approach would ensure we don't miss any commits that should be included in the next release, and it's easier to track what has been backported.

Just want to make sure, does this sound good to you?

I have created separate PR for this #1610

@reshke
Copy link
Contributor Author

reshke commented Mar 11, 2026

Hi @reshke, let me clarify my previous comment.

My concern is about the cherry-pick strategy for the upcoming release (e.g., 2.2). Currently, the main branch contains not only the commits cherry-picked from PostgreSQL (14.4-14.20), but also other development changes mixed in between.

For easier management, I suggest we start from the point where the last 2.1 cherry-pick ended and cherry-pick all eligible commits from main to REL_2_STABLE together. This would be more convenient than:

  1. The current PR only includes commits cherry-picked from PostgreSQL
  2. Other eligible commits on main would need to be identified and cherry-picked separately

My suggested approach would ensure we don't miss any commits that should be included in the next release, and it's easier to track what has been backported.

Just want to make sure, does this sound good to you?

Sorry, I messed up with #1610, here is another try #1611
I decided to make all diskquota-related commit cherry-pick and all before (ffe370b and parents) in two separate PR for ease of review. Is it OK?

@tuhaihe
Copy link
Member

tuhaihe commented Mar 12, 2026

Sorry, I messed up with #1610, here is another try #1611 I decided to make all diskquota-related commit cherry-pick and all before (ffe370b and parents) in two separate PR for ease of review. Is it OK?

Take it easy. Your approach looks great to me! Thanks for your excellent work.

It would be better to list the excluded commits that are not cherry-picked for REL_2_STABLE for clarity, if any, FYI.

tglsfdc and others added 4 commits March 13, 2026 12:46
The code tried to access ARR_DIMS(v)[0] and ARR_LBOUND(v)[0]
whether or not those values exist.  This made the range check
on the "n" argument unstable --- it might or might not fail, and
if it did it would report garbage for the allowed upper limit.
These bogus accesses would probably annoy Valgrind, and if you
were very unlucky even lead to SIGSEGV.

Report and fix by Martin Kalcher.  Back-patch to v14 where this
function was added.

Discussion: https://postgr.es/m/baaeb413-b8a8-4656-5757-ef347e5ec11f@aboutsource.net
Commit fac1b47 thought we could check for set-returning functions
by testing only the top-level node in an expression tree.  This is
wrong in itself, and to make matters worse it encouraged others
to make the same mistake, by exporting tlist.c's special-purpose
IS_SRF_CALL() as a widely-visible macro.  I can't find any evidence
that anyone's taken the bait, but it was only a matter of time.

Use expression_returns_set() instead, and stuff the IS_SRF_CALL()
genie back in its bottle, this time with a warning label.  I also
added a couple of cross-reference comments.

After a fair amount of fooling around, I've despaired of making
a robust test case that exposes the bug reliably, so no test case
here.  (Note that the test case added by fac1b47 is itself
broken, in that it doesn't notice if you remove the code change.
The repro given by the bug submitter currently doesn't fail either
in v15 or HEAD, though I suspect that may indicate an unrelated bug.)

Per bug #17564 from Martijn van Oosterhout.  Back-patch to v13,
as the faulty patch was.

Discussion: https://postgr.es/m/17564-c7472c2f90ef2da3@postgresql.org
@reshke reshke force-pushed the rel_2_1566p1 branch 2 times, most recently from e42b84b to c8a9598 Compare March 13, 2026 18:49
tglsfdc and others added 2 commits March 13, 2026 19:48
Remove the test case added by commit fac1b47, which never actually
worked to expose the problem it claimed to test.  Replace it with
a case that does expose the problem, and also covers the SRF-not-
at-the-top deficiency repaired in 1aa8dad.

Richard Guo, with some editorialization by me

Discussion: https://postgr.es/m/17564-c7472c2f90ef2da3@postgresql.org
When inserting a view referencing a foreign table that has WITH CHECK
OPTION constraints, in single-insert mode postgres_fdw retrieves the
data that was actually inserted on the remote side so that the WITH
CHECK OPTION constraints are enforced with the data locally, but in
batch-insert mode it cannot currently retrieve the data (except for the
row first inserted through the view), resulting in enforcing the WITH
CHECK OPTION constraints with the data passed from the core (except for
the first-inserted row), which led to incorrect results when inserting
into a view referencing a foreign table in which a remote BEFORE ROW
INSERT trigger changes the rows inserted through the view so that they
violate the view's WITH CHECK OPTION constraint.  Also, the query
inserting into the view caused an assertion failure in assert-enabled
builds.

Fix these by disabling batch insertion when inserting into such a view.

Back-patch to v14 where batch insertion was added.

Discussion: https://postgr.es/m/CAPmGK17LpbTZs4m4a_6THP54UBeK9fHvX8aVVA%2BC6yEZDZwQcg%40mail.gmail.com
tglsfdc added 6 commits March 13, 2026 21:12
statext_is_compatible_clause_internal() checked that the arguments
of a ScalarArrayOpExpr are one Var and one Const, but it would allow
cases where the Const was on the left.  Subsequent uses of the clause
are not expecting that and would suffer assertion failures or core
dumps.  mcv.c also had not bothered to cope with the case of a NULL
array constant, which seems really unacceptably sloppy of somebody.
(Although our tools failed us there too, since AFAIK neither Coverity
nor any compiler warned of the obvious use-of-uninitialized-variable
condition.)  It seems best to handle that by having
statext_is_compatible_clause_internal() reject it.

Noted while fixing bug #17570.  Back-patch to v13 where the
extended stats code grew some awareness of ScalarArrayOpExpr.
Since v14, the extended stats machinery will try to estimate for
otherwise-unsupported boolean expressions if they match an expression
available from an extended stats object.  mcv.c did not get the memo
about this, and would spit up with "unknown clause type".  Fortunately
the case is easy to handle, since we can expect the expression yields
boolean.

While here, replace some not-terribly-on-point assertions with
simpler runtime tests for lookup failure.  That seems appropriate
so that we get an elog not a crash if we somehow get to the new
it-should-be-a-bool-expression code with a subexpression that
doesn't match any stats column.

Per report from Danny Shemesh.  Thanks to Justin Pryzby for
preliminary investigation.

Discussion: https://postgr.es/m/CAFZC=QqD6=27wQPOW1pbRa98KPyuyn+7cL_Ay_Ck-roZV84vHg@mail.gmail.com
On closer inspection, mcv.c isn't as broken for ScalarArrayOpExpr
as I thought.  The Var-on-right issue is real enough, but actually
it does cope fine with a NULL array constant --- I was misled by
an XXX comment suggesting it didn't.  Undo that part of the code
change, and replace the XXX comment with something less misleading.
As usual, the release notes for older branches will be made by cutting
these down, but put them up for community review first.

Due to the out-of-cycle release of 14.4, there are a number of commits
that appeared in 14.4 that are not yet shipped in the earlier branches.
This draft repeats those release note entries for convenience in
preparing the older-branch notes later.  They'll be stripped out of
the 14.5 section after that's done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants